<?php

include("api.php");

$controller = request::get('controller');
$action = request::get('action');

if ($controller == "scores") {
	require("scores.php");
	exit();
} elseif ($controller == "messages") {
	require("messages.php");
	exit();
} elseif ($controller == "multiplications") {
	require("multiplications.php");
	exit();
}


/* Bientot ne sera plus la car pas utile ici a transferer dans cards180... */

if ($action == 'addScore') {

	$new = $_REQUEST;
	$data = array();
	$data['time'] = request::get('time');
	$data['pseudo'] = request::get('pseudo');
	$data['timestamp'] = time();	
	OrmNode::upsert("scores", array_keys($data), $data);	
	echo(json_encode($new));

} else {

	$new = cards180count::get180SuffledCards(IMAGES_PATH);
	echo(json_encode($new));
	
}
